package easy.trace;


import java.io.Serializable;

public class Annotation implements Serializable {
    public static final String CLIENT_SEND = "cs";
    public static final String CLIENT_RECEIVE = "cr";
    public static final String SERVER_SEND = "ss";
    public static final String SERVER_RECEIVE = "sr";
    private Long timestamp;
    private String value;
    private Endpoint host;
    private Integer duration;

    public Annotation() {
    }

    public Annotation(Long timestamp, String value, Endpoint host) {
        this.timestamp = timestamp;
        this.value = value;
        this.host = host;
    }

    public Long getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Endpoint getHost() {
        return this.host;
    }

    public void setHost(Endpoint host) {
        this.host = host;
    }

    public Integer getDuration() {
        return this.duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public String toString() {
        return "Annotation{timestamp=" + this.timestamp + ", value='" + this.value + '\'' + ", host=" + this.host + ", duration=" + this.duration + '}';
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (!(o instanceof Annotation)) {
            return false;
        } else {
            Annotation that = (Annotation)o;
            if (this.duration != null && !this.duration.equals(that.duration)) {
                return false;
            } else if (!this.host.equals(that.host)) {
                return false;
            } else if (!this.timestamp.equals(that.timestamp)) {
                return false;
            } else {
                return this.value.equals(that.value);
            }
        }
    }

    public int hashCode() {
        int result = this.timestamp.hashCode();
        result = 31 * result + this.value.hashCode();
        result = 31 * result + this.host.hashCode();
        result = 31 * result + this.duration.hashCode();
        return result;
    }
}
